import React from 'react';
import ReactDOM from 'react-dom';

import CustomEditor from './components/CustomEditor';

const keywords = [
    // groovy 关键词
    "as", "catch", "def", "enum", "for", "import", "new", "super", "throws", "while",
    "assert", "class", "default", "extends", "goto", "in", "null", "switch", "trait", "break",
    "const", "do", "false", "if", "instanceof", "package", "this", "true", "case", "continue", "else",
    "finally", "implements", "interface", "return", "throw", "try",
    // java 关键词
    "abstract", "transient", "int", "strictfp", "synchronized", "boolean", "char", "do",
    "final", "private", "short", "void", "double", "long", "protected", "static", "volatile",
    "byte", "float", "native", "public",
    // JDK 常用类
    "System", "Runtime", "String", "StringBuffer", "StringBuilder", "Date", "DateFormat",
    "SimpleDateFormat", "Calendar", "GregorianGalendar", "Math", "Integer", "Double", "Float",
    "Boolean", "List", "HashMap", "Map", "ArrayList", "Arrays", "Random", "Iterator"
];

const defaultCode = "";
const getCode = (code) => {
    console.log(code);
}

ReactDOM.render(
    <CustomEditor
        defaultCode={defaultCode}
        readOnly={false}
        height={400}
        theme="night"
        activeLine={true}
        fold={true}
        keywords={keywords}
        onChange={getCode}
    />,
    document.getElementById('app')
);
